﻿using JE.MicroMVVM.Example.DataModels;
using JE.MicroMVVM.Example.Views;
using MicroMVVM;
using MicroMVVM.Helpers;
using MicroMVVM.Navigation;
using System.Windows.Input;
using Windows.UI.Xaml.Controls;

namespace JE.MicroMVVM.Example.ViewModels
{
    [ExportViewModel("SecondPageViewModel")]
    public class SecondPageViewModel : INavigation, IDesigntimeAware
    {
        /// <summary>
        /// Gets/Sets the current page for this viewmodel.
        /// </summary>
        public Frame Current { get; set; }

        public ICommand NavigateCommand { get; set; }

        [ImportingConstructor]
        public SecondPageViewModel()
        {
            NavigateCommand = new DelegateCommand(OnNavigateCommand);
        }

        private void OnNavigateCommand(object obj)
        {
            this.Navigate(typeof (ThirdPage));
        }

        /// <summary>
        /// On navigating away from the current view.
        /// </summary>
        public void OnNavigating()
        {
            var test = string.Empty;
        }

        /// <summary>
        /// On finished navigating to the current view.
        /// </summary>
        /// <param name="parameter"></param>
        public void OnNavigated(object parameter)
        {
            var obj = this.GetParametrizedData<DataModelOne>(parameter);
        }

        /// <summary>
        /// Sets the designtime data for this particular viewmodel.
        /// </summary>
        public void DesigntimeAware()
        {
        }
    }
}